<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>用户点赞</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="{$url_js}jquery-2.2.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}layer/layer.js"></script>
	
	<style type="text/css">
		{literal}
		.page_info div {
			display: inline-block;
		}

		.page_info .p_l {
			color: #666;
			float: left;
			line-height: 69px;
			font-size: 16px;
		}

		.page_info .p_r {
			color: #337AB7;
			float: right;
		}

		{/literal}
	</style>
</head>
<body>

<div class="container" style="width:96%">
	<table class="table table-bordered table-striped" align="center">
		<tr align="center">
			<td style="width: 45%">用户ID</td>
			<td style="width: 45%">名称</td>
			<td style="width: 10%">{if $type == 2 || $type == 3}关注{else}点赞{/if}</td>
		</tr>
		{if $list}
			{foreach $list as $k => $v}
				<tr align="center">
					<td>{$v.UserId}</td>
					<td>{$v.NickName}</td>
					<td><label><input type="checkbox" class="checkLike" data_type="{$type}" data_id="{$id}" value="{$v.UserId}"{if in_array($v.UserId,$like_userId)}checked{/if}/></label></td>
				</tr>
			{/foreach}
			<tr>
				<td colspan="2"></td>
				<td align="center">
					<a class="btn btn-info" onclick="changeAll('{$ids}',{$id},{$type})" id="checkAll">批量{if $type == 2 || $type == 3}关注{else}点赞{/if}</a>
				</td>
			</tr>
		{else}
			<td colspan="12">本页暂无相关数据</td>
		{/if}

	</table>
	<table class="table table-bordered table-striped" align="center">
		<tr>
			<td colspan="7" align="right">
				<div class="page_info">
					{if $page_info['count']}
						<div class="p_l">一共 {$page_info['count']} 条数据,共 {$page_info['page']} 页</div>{/if}
				</div>
				<div class="p_r">{$pagination}</div>
			</td>
		</tr>
	</table>
</div>
	{literal}
		<script type="text/javascript">
			$(".checkLike").click(function () {
			    var type,id,_this,userId;
			    _this = $(this);
                userId = _this.val();
                id = _this.attr('data_id');
			    type = _this.attr('data_type');
                $.ajax({
                    url: 'userPrivate.php?do=ChangeLike',
                    type: 'post',
                    data: {'id': id,'userId':userId,'type':type},
                    dataType: 'json',
                    success: function (re) {

                    }
                });
            });
			
			function changeAll(ids,id,type) {
                top.swal({
                    title: "正在修改！",
                    text: "请不要进行操作",
                    showConfirmButton: false
                });
                $.ajax({
                    url: 'userPrivate.php?do=ChangeAll',
                    type: 'post',
                    data: {'id': id,'userIds':ids,'type':type},
                    dataType: 'json',
                    success: function (re) {
						if(re.type == 'yes'){
                            $('.checkLike').prop('checked', true);
                            top.swal('发送成功', 'success');
                        }else {
                            top.swal('已全部添加!');
                        }
                    }
                });
            }
			
//			$(".add").click(function () {
//			    var _this = $(this);
//			    var id = _this.attr("data_id");
//			    var nickName = _this.attr("data_name");
//                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
//                var userNick = parent.$("#userNick");
//                var userId = parent.$("#userId");
//
//
//                userNick.removeAttr("value");
//                userNick.val(nickName);
//
//                userId.removeAttr("value");
//                userId.val(id);
//
//                parent.layer.close(index); //再执行关闭
//            });

		</script>
	{/literal}
</body>
</html>